#ifndef MPEG_DECOMPRESS_H
#define MPEG_DECOMPRESS_H

#include <gst/gst.h>
#include <gst/app/app.h>
#include <functional>
#include <thread>

class MPEG_Decompress
{
  public:
    MPEG_Decompress();
    virtual ~MPEG_Decompress();
    void InputData(const char* data,std::size_t size);
    std::function<void(const char* data,std::size_t size)> funcOutputData;

  private:
    friend void pad_added_handler (GstElement *src, GstPad *pad, MPEG_Decompress *data);
    GstElement *appsrc,*jpegparse,*mpeg2dec,*videoconvert,*videoscale,*appsink,*pipeline;
    GstElement *fakesink;
    GMainLoop* loop;
    std::thread mainThread;
    std::thread receiveThread;
};

#endif
